<!DOCTYPE html>
<html>
<head>
    <title>录入住院信息--中软高科-2015</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../Css/style.css" />
    <script type="text/javascript" src="../Js/jquery.js"></script>
    <script type="text/javascript" src="../Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../Js/ckform.js"></script>
    <script type="text/javascript" src="../Js/common.js"></script>
    <script type="text/javascript" src="../Js/ckeditor/ckeditor.js"></script>
 

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    <script type="text/javascript">
    $(function () {       
		$('#backid').click(function(){
				window.location.href="index.html";
		 });
    });
    </script>
</head>
<body>
<form id="updateForm" class="definewidth m20">
<table class="table table-bordered table-hover definewidth m10">
    <tr>
        <td width="10%" class="tableleft">病历号</td>
        <td><div id="hoR_id"></div></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">姓名</td>
        <td><div id="name"></div></td>
    </tr>
    <tr>
        <td width="10%" class="tableleft">证件号</td>
        <td><div id="idNumber"></div></td>
    </tr>
	
	<tr>
        <td width="10%" class="tableleft">余额</td>
        <td><div id="restCost"></div></td>
    </tr>
	
    <tr>
        <td width="10%" class="tableleft">缴费押金</td>
        <td><input type="hidden" id="registerId" name="registerId" value="">
            <input type="text" name="newDeposit"  id="newDeposit" value=""/>元</td>
    </tr>

    <tr>
        <td colspan="2">
                <input type="button" value="保存"class="btn btn-primary"onclick="update()" >
				 &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>

		</td>
    </tr>
</table>
</form>
</body>
<script>
    $(function () {
        loadFunction();
    })
    function oneValues(){
        let result;
        let url=window.location.search; //获取url中"?"符后的字串
        if(url.indexOf("?")!=-1){
            result = url.substr(url.indexOf("=")+1);
        }
        return result;
    }
    function loadFunction() {
    $.ajax({
        type: "GET",
        url: "/HMC/findByID",
        data: {"id":oneValues()},
        dataType:"json",
        success: function(vo) {
            let data = vo.obj;
            document.getElementById('hoR_id').innerHTML=data.id;
            document.getElementById('name').innerHTML=data.registerName;
            document.getElementById('idNumber').innerHTML=data.idNumber;
            document.getElementById('restCost').innerHTML=data.hospital.restCost;
            $("#registerId").val(data.id);
        }

    })
    }
    function update(){
        $.ajax({
            type:"POST",
            url: "/HMC/updateAdd_many",
            data:$('#updateForm').serialize(),
            dataType:"json",
            success: function(vo) {
                alert("添加成功")
                window.location.href="index.html";
            },
            error :function (){
            alert("添加失败")
            }
    })
    }
</script>
</html>